package com.fivestar.pmanager.dao.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.fivestar.pmanager.core.mapper.DBActionMapper;
import com.fivestar.pmanager.core.mapper.PaginatingMapper;
import com.fivestar.pmanager.model.SysModuleBean;
import com.fivestar.pmanager.model.SysOperationBean;


/**
 * 操作
 * SysOperationMapper
 * @author 
 *
 */
@Repository("sysOperationMapper")
public interface SysOperationMapper extends DBActionMapper<SysOperationBean>,
        PaginatingMapper<SysOperationBean>
{
    @Results({
            @Result(property = "rowId", column = "row_id"),
            @Result(property = "moduleName", column = "module_name"),
            @Result(property = "moduleCode", column = "module_code"),
            @Result(property = "parentId", column = "parent_id"),
            @Result(property = "moduleUrl", column = "module_url")
    })
    @Select("select DISTINCT sm.row_id,sm.`module_name`,sm.`module_code`,sm.`parent_id`,sm.`module_url` " +
            "from `sys_operation_url` sou " +
            "inner join `sys_operation` so on so.`row_id` = sou.`opn_id` " +
            "inner join `sys_module` sm on sm.`row_id` = so.`mdl_id` " +
            "where sou.`opn_url` = #{url}")
	SysModuleBean findModuleByOperation(@Param("url") String operationUrl);
    
}
